package com.sambo.inspection.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import com.luck.picture.lib.photoview.OnViewTapListener;
import com.luck.picture.lib.photoview.PhotoView;
import com.sambo.inspection.R;
import com.sambo.inspection.activity.support.BaseActivity;
import com.sambo.inspection.common.image.ImageLoader;

public class ImageShowActivity extends BaseActivity {

    ImageView ivBack;
    PhotoView ivImageShow;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_image_show);

        ivBack = findViewById(R.id.iv_back);
        ivImageShow = findViewById(R.id.iv_image_show);

        String url = getIntent().getStringExtra("imageUrl");

        ivBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
                overridePendingTransition(0, com.luck.picture.lib.R.anim.a3);
            }
        });

        ivImageShow.setOnViewTapListener(new OnViewTapListener() {
            public void onViewTap(View view, float x, float y) {
                finish();
                overridePendingTransition(0, com.luck.picture.lib.R.anim.a3);
            }
        });

        ImageLoader.getInstance().displayImage(this, url, ivImageShow);
    }

    public void onBackPressed() {
        super.onBackPressed();
        finish();
        overridePendingTransition(0, com.luck.picture.lib.R.anim.a3);
    }
}
